package com.hunktimes.wholesale.ui.pages

import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hunktimes.wholesale.R
import com.hunktimes.wholesale.base.BasePageFragment
import com.hunktimes.wholesale.databinding.TitleBarListBinding

/**
 * Author: Delete
 * Date: 2020/7/28 20:01
 * Description:
 *
 */
class CommentsFragment : BasePageFragment(R.layout.title_bar_list) {
    lateinit var viewBinding: TitleBarListBinding

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        viewBinding = TitleBarListBinding.bind(view)
    }

    override fun onStart() {
        super.onStart()
        initComments()
    }


    val commentAdapter = CommentsAdapter()
    fun initComments() {
        val commentLm = LinearLayoutManager(requireContext())
        commentLm.orientation = LinearLayoutManager.VERTICAL
        viewBinding.recyclerList.recyclerView.layoutManager = commentLm
        viewBinding.recyclerList.recyclerView.adapter = commentAdapter

        val data = mutableListOf<String>()
        for (i in 1..4) {
            data.add("購物車推薦$i")
        }
        commentAdapter.data = data
    }
}


class CommentsAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_comment) {
    override fun convert(holder: BaseViewHolder, item: String) {

    }
}